<template>
  <span>
    <span
      v-for="(item, index) in list"
      :key="index"
    >
      <el-tag
        v-if="item.value === value"
        v-bind="$attrs"
        :type="type"
        v-on="$listeners"
      >
        {{ $t(item.label) }}
      </el-tag>
    </span>
  </span>
</template>
<script>
import Vue from 'vue';
import {Tag} from "element-ui";
Vue.use(Tag);
/**
 * element-ui的[el-tag](https://element.eleme.cn/#/zh-CN/component/tag)
 * @author maolin
 */
export default {
  name: "ErpTag",
  props: {
    /**
     * 标签列表
     * @public
     */
    list: {
      type: Object,
      default () {
        return {};
      }
    },
    /**
     * 当前标签值
     * @public
     */
    value: {
      type: Number,
      default () {
        return null;
      }
    },
    /**
     * 标签类型
     * @public
     */
    type: {
      type: String,
      default: 'primary'
    }
  }
};
</script>

<style scoped>

</style>
